package com.cloud.item;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
@SpringBootApplication
@EnableDiscoveryClient      // 开启服务发现功能
@EnableEurekaClient         // 开启Eureka客户端
@EnableCircuitBreaker       // 开启微服务熔断
@EnableFeignClients        // 开启Feign远程调用
public class ItemApplication {
    public static void main(String[] args) {
        SpringApplication.run(ItemApplication.class);
    }

    @Bean
    @LoadBalanced           // 负载均衡
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
